package com.apes.fn.scm.purchase.repository;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.apes.framework.query.ApesDao;
import org.springframework.stereotype.Component;

/**
 * Created by lishikun on 2021/8/4 15:06
 */
@Component
public class ProductPriceDao extends ApesDao {
    /**
     * 获取询价数据
     * @param param
     * @return
     */
    public JSONArray getInquiryPool(JSONObject param) {
        String sql = "SELECT T.*, " +
                "       (SELECT ABBREVIATION " +
                "           FROM MAS_PARTY_ROLE Z, MAS_PARTY X " +
                "          WHERE SUBSTR(T.GYSID,3) = Z.ID " +
                "            AND Z.PARTY_ID = X.ID) SUPPLIER_NAME " +
                "  FROM PUR_SPXJD_ZXB T  " +
                "  WHERE T.SPID IN :PRODUCT_ID " +
                "  AND T.MDID = :OLD_DEPT ";
        return toJSONArray(find(sql, param));
    }
}
